Updating a Progress Bar within the Status Bar [migrated]

Posted by Muhnamana on Programmers See other posts from Programmers or by Muhnamana
Published on 2012-04-10T14:08:06Z Indexed on 2012/04/10 17:45 UTC
Read the original article Hit count: 270

I'm trying to figure out how to incorporate a progress bar within the status bar to show how much processing is completed. Below is my example of updating the progress bar (not sure if this is the correct way or not)

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    ToolStripProgressBar1.Value = ToolStripProgressBar1.Value + 2
    If ToolStripProgressBar1.Value = 100 Then
        ToolStripProgressBar1.Value = 0
        ToolStripProgressBar1.Value = ToolStripProgressBar1.Value + 2
        Timer1.Enabled = True
    End If
End Sub

Here is the code within the button.

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1Run.Click
    ToolStripStatusLabel1.Text = "Processing..."
    Timer1.Enabled = True

    'more code to be inserted here        

End Sub

What I'm not sure is how to update the progress bar based on the amount of code you have and once the processing is complete, update the ToolStripStatusLabel1 to show "Processing...Complete!".

© Programmers or respective owner

Related posts about visual-studio-2010

Related posts about visual-basic